//
// Created by xili on 2024/8/2 22:06.
// Go big or go home.
//
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;

class Solution {
public:
    int countWords(vector<string> &words1, vector<string> &words2) {
        unordered_map<string, int> ump1;
        unordered_map<string, int> ump2;
        int ans = 0;
        for (auto &item: words1) {
            ump1[item]++;
        }
        for (auto &item: words2) {
            ump2[item]++;
        }
        for (auto &item: words1) {
            if (ump1[item] == 1 && ump2[item] == 1) {
                ans++;
            }
        }
        return ans;
    }
};